<?php
Class session {

	function  __construct()  {
        session_start();       
                      }
	
	function login ($username,$password){

	$result = mysql_query("SELECT * FROM admin WHERE username='$username'") or die ("Error");
	$data = mysql_fetch_array($result);

	//$pengacak ="NDJS3289JSKS190JISJI";

	if($data && $password == $data['password'])
	{
	$_SESSION['username']=$username;
	//echo "Berhasil Login, Selamat datang admin $username";
	//header ('location: halamandashboard.php');
	return true;
	
	}else {
			return false;
			}
	}
	
	function logout (){
	session_destroy();
	}
}
?>